
//图表搜索
function chartsearch(){
	 if($("#academySelect").val()==""){
		 alert("请选择学院");
		 return false;
	 }else if($("#classSelect").val()==""){
		 alert("请选择班级");
		 return false;
	 }else if($("#courseSelect").val()==""){
		 alert("请选择课程");
		 return false;
	 }else {
		 getData(); //异步ajax动态加载数据
	 }
	
}

function getData() { 
	
	var UrlCheckIn = 'admin/checkin_queryCheckIn.action?pageFinder.pageNo=1';
	   
	if($("#academyName").val()!=""){
		UrlCheckIn = UrlCheckIn+"&pageing.academy="+$("#academyName").val();
	 }
	if($("#className").val()!=""){
		UrlCheckIn = UrlCheckIn+"&pageing.stuClass="+$("#className").val();
	 }
	if($("#courseName").val()!=""){
		UrlCheckIn = UrlCheckIn+"&pageing.course="+$("#courseName").val();
		 
	 }
	console.log(UrlCheckIn);
	//查询考勤图表
	$.ajax({
        type: "get",
        cache: false,
        url: UrlCheckIn,
        dataType: "json",
        success: function (result) {
       	 var json= eval("("+result+")")["dataList"];
       	
        var table1 = $("#voCheckIn");
        table1.find("tr[name='trc']").remove();
        var firstTr = table1.find("tbody>tr:first");
       
        var labels1 = new Array();
        var datasets1 =  new Array();
        var labels2 = new Array();
        var datasets2 =  new Array();
        var labels3 = new Array();
        var datasets3 =  new Array();
       	 $.each(json,function(index,content){
       		labels1[index] = content.stuName;
       		labels2[index] = content.stuName;
       		labels3[index] = content.stuName;
            datasets1[index] = content.vacate;
            datasets2[index] = content.beLate;
            datasets3[index] = content.truancy;
       		 });
       	 Canvas1(labels1,datasets1);
       	 Canvas2(labels2,datasets2);
       	 Canvas3(labels3,datasets3);
        },
        error: function (result) {
          console.log(result);
        }
    }

    );
}
